package com.itheima.demo;

//智能控制系统
public class SmartHomeControl {

    private static SmartHomeControl instance = new SmartHomeControl();

    private SmartHomeControl(){};
    public static SmartHomeControl getInstance() {
        return instance;
    }

    public void control(HouseholdAppliance householdAppliance) {
        System.out.println("开始控制" + householdAppliance.getName() + "开关");
        System.out.println(householdAppliance.getName() + "初始开关状态：" + householdAppliance.isStatus());
        householdAppliance.SwitchStatus();
        System.out.println(householdAppliance.getName() + "更改后开关状态：" + householdAppliance.isStatus());
    }
    public void printAllStatus(HouseholdAppliance[] householdAppliances) {
        for (HouseholdAppliance householdAppliance : householdAppliances) {
            System.out.println(householdAppliance.getName() + "开关状态：" + householdAppliance.isStatus());
        }
    }
}
